/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.startup.musicstore.app.facade;

import com.startup.musicstore.services.AlbumRatingService;
import com.startup.musicstore.services.AlbumService;
import com.startup.musicstore.services.ComputeOrderAmountService;
import com.startup.musicstore.services.CustomerInvoiceService;
import com.startup.musicstore.services.InventoryService;
import com.startup.musicstore.services.PendingService;
import com.startup.musicstore.services.SalesService;
import com.startup.musicstore.services.crud.AlbumCategoryCrudService;
import com.startup.musicstore.services.crud.AlbumCrudService;
import com.startup.musicstore.services.crud.ArtistInformationCrudService;
import com.startup.musicstore.services.crud.CreditCardCrudService;
import com.startup.musicstore.services.crud.CustomerAddressCrudService;
import com.startup.musicstore.services.crud.CustomerCrudService;
import com.startup.musicstore.services.crud.CustomerInvoiceCrudService;
import com.startup.musicstore.services.crud.MarketingInformationCrudService;
import com.startup.musicstore.services.crud.OrderCrudService;
import com.startup.musicstore.services.crud.OrderItemCrudService;
import com.startup.musicstore.services.crud.ReviewCrudService;
import com.startup.musicstore.services.crud.TrackCrudService;
import java.io.Serializable;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author aljay19
 */
public class Facade implements Serializable {

//    private final static ApplicationContext ctx = GetContext.getApplicationContext();
    private final static ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:com/startup/musicstore/app/conf/applicationContext-*.xml");
    private CustomerCrudService customerCrudService;
    private CustomerAddressCrudService customerAddressCrudService;
    private CreditCardCrudService creditCardCrudService;
    private CustomerInvoiceCrudService customerInvoiceCrudService;
    private OrderCrudService orderCrudService;
    private OrderItemCrudService orderItemCrudService;
    private AlbumCrudService albumCrudService;
    private AlbumCategoryCrudService albumCategoryCrudService;
    private TrackCrudService trackCrudService;
    private MarketingInformationCrudService marketingInformationCrudService;
    private ReviewCrudService reviewCrudService;
    private ArtistInformationCrudService artistInformationCrudService;
    private AlbumService albumService;
    private SalesService salesService;
    private InventoryService inventoryService;
    private PendingService pendingService;
    private ComputeOrderAmountService computeOrderAmountService;
    private CustomerInvoiceService customerInvoiceService;
    private AlbumRatingService albumRatingService;

    //Model crud services
    public CustomerCrudService getCustomerCrudService() {
        customerCrudService = (CustomerCrudService) ctx.getBean("customerCrudService");
        return customerCrudService;
    }

    public CustomerAddressCrudService getCustomerAddressCrudService() {
        customerAddressCrudService = (CustomerAddressCrudService) ctx.getBean("customerAddressCrudService");
        return customerAddressCrudService;
    }

    public CreditCardCrudService getCreditCardCrudService() {
        creditCardCrudService = (CreditCardCrudService) ctx.getBean("creditCardCrudService");
        return creditCardCrudService;
    }

    public CustomerInvoiceCrudService getCustomerInvoiceCrudService() {
        customerInvoiceCrudService = (CustomerInvoiceCrudService) ctx.getBean("customerInvoiceCrudService");
        return customerInvoiceCrudService;
    }

    public OrderCrudService getOrderCrudService() {
        orderCrudService = (OrderCrudService) ctx.getBean("orderCrudService");
        return orderCrudService;
    }

    public OrderItemCrudService getOrderItemCrudService() {
        orderItemCrudService = (OrderItemCrudService) ctx.getBean("orderItemCrudService");
        return orderItemCrudService;
    }

    public AlbumCrudService getAlbumCrudService() {
        albumCrudService = (AlbumCrudService) ctx.getBean("albumCrudService");
        return albumCrudService;
    }

    public AlbumCategoryCrudService getAlbumCategoryCrudService() {
        albumCategoryCrudService = (AlbumCategoryCrudService) ctx.getBean("albumCategoryCrudService");
        return albumCategoryCrudService;
    }

    public TrackCrudService getTrackCrudService() {
        trackCrudService = (TrackCrudService) ctx.getBean("trackCrudService");
        return trackCrudService;
    }

    public MarketingInformationCrudService getMarketingInformationCrudService() {
        marketingInformationCrudService = (MarketingInformationCrudService) ctx.getBean("marketingInformationCrudService");
        return marketingInformationCrudService;
    }

    public ReviewCrudService getReviewCrudService() {
        reviewCrudService = (ReviewCrudService) ctx.getBean("reviewCrudService");
        return reviewCrudService;
    }

    public ArtistInformationCrudService getArtistInformationCrudService() {
        artistInformationCrudService = (ArtistInformationCrudService) ctx.getBean("artistInformationCrudService");
        return artistInformationCrudService;
    }

    //Custom services
    public AlbumService getAlbumService() {
        albumService = (AlbumService) ctx.getBean("albumService");
        return albumService;
    }

    public SalesService getSalesService() {
        salesService = (SalesService) ctx.getBean("salesService");
        return salesService;
    }

    public InventoryService getInventoryService() {
        inventoryService = (InventoryService) ctx.getBean("inventoryService");
        return inventoryService;
    }

    public PendingService getPendingService() {
        pendingService = (PendingService) ctx.getBean("pendingService");
        return pendingService;
    }

    public ComputeOrderAmountService getComputeOrderAmountService() {
        computeOrderAmountService = (ComputeOrderAmountService) ctx.getBean("computeOrderAmountService");
        return computeOrderAmountService;
    }

    public CustomerInvoiceService getCustomerInvoiceService() {
        customerInvoiceService = (CustomerInvoiceService) ctx.getBean("customerInvoiceService");
        return customerInvoiceService;
    }
    
    public AlbumRatingService getAlbumRatingService() {
        albumRatingService = (AlbumRatingService) ctx.getBean("albumRatingService");
        return albumRatingService;
    }

}
